package principal;

public class Semaforo extends Thread{
	private static int posicaoSemaforo;
	private static int cor; //1-verde, 2-amarelo, 3-vermelho
	
	public Semaforo(){
		posicaoSemaforo = 550;
		
	}
	
	public void run(){
		while(!Simulacao.getInstance().fimDaSimulacao()){
			mudaDeCor();
			
			
		}
	}
	
	private void mudaDeCor(){
		cor = 1;
		try {
			Thread.sleep(4000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		cor = 2;
		try {
			Thread.sleep(4000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
//		cor = 3;
//		Thread.sleep(4000);
		
		
		
	}

	public static int getCor() {
		return cor;
	}

	public static int getPosicaoSemaforo() {
		return posicaoSemaforo;
	}

}
